<?php
// modules/article/Form/Translation.php

class article_Form_Translation extends Zend_Form
{

    protected $_noDecorator = array(
        'ViewHelper', 
        'Errors'
    );
    public function cluBuild($params)
    {
        // set the method for the display form to POST
        $this->setAttrib('id', 'new_translation');
        $this->setMethod('post');
        $this->setAction($params['action_url']);
//        $this->setAction('/en/article/index/translate');
//        $actionTranslate = $params['view']->hvnUrl(array('module' => 'article', 'action'=>'translate'), 'nocontroller');
//    	$this->setAction($actionTranslate);

        $filterTrim = new Zend_Filter_StringTrim();
        $myValidator = new Zend_Validate_Regex('/^[A-Z0-9_\s\-]*$/i'); //alpha, num, space, -, _
        $myValidator->setMessage(t(60), Zend_Validate_Regex::NOT_MATCH);
        $this->addElementPrefixPath('Clu_Filter', 'Clu/Filter/', 'filter');
                
       
        //add story title
        $title = new Zend_Form_Element_Text('title', 
                         array('disableLoadDefaultDecorators' => true,
                               'required'   => true,             
                               'class' => 'inputText'));
        
        $title->addDecorators($this->_noDecorator)
              ->addFilter($filterTrim);
              //->addValidator($myValidator);TODO: Chinese characters
        $this->addElement($title);
        
        //add keywords
        $keywords = new Zend_Form_Element_Text('keywords', 
                         array('disableLoadDefaultDecorators' => true,
                               /*'required'   => true,*/             
                               'class' => 'inputText'));
        
        $keywords->addDecorators($this->_noDecorator)
              ->addFilter($filterTrim);
              //->addValidator($myValidator);TODO Chinese
        $this->addElement($keywords);
        
        //add status change reason
        $statuschange_reason = new Zend_Form_Element_Text('statuschange_reason', 
                         array('disableLoadDefaultDecorators' => true,
                               'class' => 'inputText'));
        
        $statuschange_reason->addDecorators($this->_noDecorator)
              ->addFilter($filterTrim)
              ->addValidator($myValidator);
        $this->addElement($statuschange_reason);
        
        //story body
        $fck = new Clu_Form_Element_FckEditor('body', array(
        		'fckOptions' => array (
        						'Height' => 600,
        						'Width'  => 600,
        						'ToolbarSet' => 'Full'
        					)
       			 )
        );
        $fck->setLabel('Article Body');
        $this->addElement($fck);
        
        // add the submit button
        $submit = new Zend_Form_Element_Submit('submit', array('disableLoadDefaultDecorators' => true, 
                                                               'label' => t(58) ));
        $submit->addDecorators($this->_noDecorator);
        $this->addElement($submit);
    }
}
